# 拉取 portainer 镜像
docker pull portainer/portainer

# 运行 portainer
docker run -d --restart=always --name portainer -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer

# 拉取 nginx 并运行
docker run \
--restart always \
--name Nginx \
-d \
-p 80:80 \
nginx

# 拷贝 nginx 的文件到 服务器
docker container cp Nginx:/etc/nginx/nginx.conf /root/chatgpt/dev-ops/nginx/conf
docker container cp Nginx:/etc/nginx/conf.d/default.conf /root/chatgpt/dev-ops/nginx/conf/conf.d
docker container cp Nginx:/usr/share/nginx/html/index.html /root/chatgpt/dev-ops/nginx/html

ssh root@192.168.6.116  -> aigcProject1024
# 从服务器拉取配置到本地
scp root@192.168.6.116:/root/chatgpt/dev-ops/nginx/conf/nginx.conf  E:/project/chatgpt/dev-ops/nginx/conf
scp root@192.168.6.116:/root/chatgpt/dev-ops/nginx/conf/conf.d/default.conf  E:/project/chatgpt/dev-ops/nginx/conf/conf.d
scp root@192.168.6.116:/root/chatgpt/dev-ops/nginx/html/index.html  E:/project/chatgpt/dev-ops/nginx/html
scp -r root@192.168.6.116:/root/chatgpt/dev-ops/nginx/logs  E:/project/chatgpt/dev-ops/nginx/
# 从本地上传配置到服务器
scp E:/project/chatgpt/dev-ops/nginx/conf/nginx.conf root@192.168.6.116:/root/chatgpt/dev-ops/nginx/conf
scp E:/project/chatgpt/dev-ops/nginx/conf/conf.d/default.conf  root@192.168.6.116:/root/chatgpt/dev-ops/nginx/conf/conf.d
docker restart Nginx # 上传配置文件需要重启服务

scp E:/project/chatgpt/dev-ops/nginx/html/index.html  root@192.168.6.116:/root/chatgpt/dev-ops/nginx/html
# 赋予权限(可不用操作)
ssh root@192.168.6.116 "chmod 777 /root/chatgpt/dev-ops/nginx/conf"


# 重新挂载, 启动 nginx(先删除)
ssh root@192.168.6.116 -> aigcProject1024 39.98.44.8 1234

docker run \
--name Nginx \
-v /root/chatgpt/dev-ops/nginx/logs:/var/log/nginx \
-v /root/chatgpt/dev-ops/nginx/html:/usr/share/nginx/html \
-v /root/chatgpt/dev-ops/nginx/conf/nginx.conf:/etc/nginx/nginx.conf \
-v /root/chatgpt/dev-ops/nginx/conf/conf.d:/etc/nginx/conf.d \
-v /root/chatgpt/dev-ops/nginx/ssl:/etc/nginx/ssl \
-p 80:80 \
--privileged=true -d --restart=always nginx

# 进入容器内部
ssh root@192.168.6.116  -> aigcProject1024
docker exec -it Nginx /bin/bash

http://624036bb.r21.cpolar.top # niginx - 80端口
